<%-- 
    Document   : food_admin
    Created on : May 1, 2012, 1:26:19 PM
    Author     : Luong
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<script type="text/javascript" src="paging/jquery-1-3-2.js"></script>
<script type="text/javascript" src="paging/tablesorter.js"></script>
<script type="text/javascript" src="paging/tablesorter_filter.js"></script>
<script type="text/javascript" src="paging/jquery.tablesorter.pager.js"></script>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<script type="text/javascript" src="JQuery/jquery.js"></script>
<script type="text/javascript" src="JQuery/additional-methods.js"></script>
<script type="text/javascript" src="JQuery/jquery.validate.js"></script>

<script type="text/javascript">
    $(function(){
        $("#testform").validate({
            rules:{
                txtseat:{
                    required:true,
                    number: true,
                    digits: true
                },
                txtdes:{
                    required:true
                },
                filename_1:{
                    accept:"bmp|png|jpg"
                }
            }
        })
    });
</script>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Tunga Restaurant</title>
        <script>
            function doDelete(){
                return confirm("Are you sure?");
            }
        </script>
        <link href="style_admin.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
        <center>
            <c:set var="session" value="${sessionScope.user}"/>
            <div class="outer">
                <!--Header end-->
                <div id="rc1"></div>
                <div id="bg">
                    <div class="toplinks"><a href="ContactUs.jsp">Contact us</a></div><div class="sap">|</div>
                    <div class="toplinks"><a href="initShowFood?action=Food">Food</a></div><div class="sap">|</div>
                    <div class="toplinks"><a href="ControllerTables?action=Table">Table</a></div><div class="sap">|</div>
                    <div class="toplinks"><a href="ControllerRooms?action=Room">Room</a></div><div class="sap">|</div>
                    <c:if test="${empty session}">
                        <div class="toplinks"><a href="registration.jsp">Register</a></div><div class="sap">|</div>
                        <div class="toplinks"><a href="login.jsp">Login</a></div><div class="sap">|</div>
                    </c:if>
                    <div class="toplinks"><a href="index.jsp">Home Page</a></div>
                    <div><font color="white">Welcome, </font><font color="yellow">${sessionScope.user}</font> </div>
                    <div>
                        <font color="yellow"><a href="ControllerCustomer?action=Information&user=${sessionScope.user}">Your information</a></font>
                        <%
                                    if (session.getAttribute("isadmin") != null) {
                        %>
                        <a href="index_admin.jsp">Admin Manager</a>
                        <%                                    }
                        %>
                        <font color="yellow">
                            <c:url var="LogOut" value="ControllerCustomer">
                                <c:param name="action" value="LogOut"/>
                            </c:url>
                            <a href="${LogOut}">LogOut</a>
                        </font>
                    </div>
                </div>
                <div id="rc2"></div>
                <div id="header">
                    <div class="name">Tunga Restaurant Admin Manager</div>
                    <div class="tag">The best restaurant in the world</div>
                </div>
                <!--Top nav end-->
                <div style="clear:left"></div>
                <div id="outer2">
                    <div id="left-nav">
                        <div class="leftlinks">
                            <span class="heading">Manage</span>
                            <ul>
                                <li><a href="ControllerCustomer?action=Customer">Customer</a></li>
                                <li><a href="ControllerFood?action=adminFood">Food</a></li>
                                <li><a href="ControllerAdminRooms?action=AdminRooms">Room</a></li>
                                <li><a href="ControllerTables?action=AdminTables">Table</a></li>
                                <li><a href="ControllerOrderFood?action=adminOrderFood">Order Food</a></li>
                                <li><a href="ControllerAdminBookRooms?action=AdminBookRooms">Book Room</a></li>
                                <li><a href="ControllerTables?action=AdminBookTables">Book Table</a></li>
                                <li><a href="report.jsp">Report</a></li>
                            </ul>
                        </div>
                    </div><div class="inner_copy"><div class="inner_copy">All <a href="http://www.magentothemesworld.com" title="Best Magento Templates">premium Magento themes</a> at Magentothemesworld.com!</div></div>
                    <div id="content" align="center">
                        <span class="heading">List Table </span>
                        <div id="main">                                                 
                            <c:set var="all" value="${applicationScope.listAdminTables}"/>
                            <c:set var="count" value="0"/>
                            <c:if test="${not empty all}">
                                <table border="0" class="fixtable tablesorter" align="center" id="myTable">
                                    <thead>
                                        <tr>
                                            <th></th>
                                        </tr>
                                    </thead>
                                    <th>Seat:</th>
                                    <th>Restaurant Name:</th>
                                    <th>Description:</th>
                                    <th>Update</th>
                                    <th>Delete</th>
                                    <c:forEach var="rows" items="${all}">
                                        <c:set var="count" value="${count+1}"/>
                                        <form action="ControllerTables" method="POST">
                                            <input type="hidden" name="id" value="${rows.tableNumber}"/>
                                            <tr>
                                                <td>${rows.noSeats}</td>
                                                <td>${rows.restaurants.resName}</td>
                                                <td>${rows.description}</td>
                                                <td><input type="submit" name="action" value="Update"/></td>
                                                <td><input type="submit" name="action" value="Delete" onclick="return doDelete();"/></td>
                                            </tr>
                                        </form>
                                    </c:forEach>
                                </table>
                            </c:if>
                            <br>
                            <br>
                            <div align="center">
                                <h1>Insert New Table</h1>
                                <form action="ControllerAdminInsertTable?action=AdminTables" ENCTYPE="multipart/form-data" method="POST" id="testform">
                                    <c:set var="loads" value="${applicationScope.insertTable}"/>
                                    <c:set var="load" value="${applicationScope.resid}"/>
                                    <table border="0">
                                        <tr>
                                            <td>Seat:</td>
                                            <td><input type="text" name="txtseat" value="" /></td>
                                        </tr>
                                        <tr>
                                            <td>Restaurant ID:</td>
                                            <td><select name="txtid">
                                                    <c:forEach var="rs" items="${load}">
                                                        <option value="${rs.resID}">${rs.resName}</option>
                                                    </c:forEach>
                                                </select>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>Description:</td>
                                            <td><textarea name="txtdes" value="" rows="10" cols="30"></textarea></td>
                                        </tr>
                                        <tr>
                                            <td><label for="filename_1">File: </label></td>
                                            <td>
                                                <input id="filename_1" type="file" name="filename_1" size="20"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td></td>
                                            <td><input type="submit" value="Insert" name="action" /> &nbsp;&nbsp;<input type="reset" value="Clear" /></td>
                                        </tr>
                                    </table>
                                </form>
                            </div>
                        </div>
                    </div>
                    <div style="clear:left"></div>
                </div>
                <!--Bottom part-->
                <div id="bottom">
                    <div id="footer"><div class="fcenter">GROUP02-F5-10-1009-S1</div></div>
                </div>
            </div>
        </center>
    </body>
</html>
<script type="text/javascript">
    jQuery(document).ready(function(){
        $("#myTable")
        .tablesorter({widgets:['zebra']})
        .tablesorterPager({container:$("#pager"),size:5});
        //.tablesorterFilter({filterContainer:$("#filter-box"),
        //     filterClearContainer:("#filter-clear-button"),
        //    filterColumns:[0],
        //     filterCaseSensitive:false });

    });
</script>
